import apiClient from '@/api/axios.js';


export class AuthApi {
    static async login(params) {
        const { userAccount, Password, loginType="password", permissionType="666" } = params;
        try {
            const response = await apiClient.post('/login', {
                userAccount,
                Password,
                loginType,
                permissionType
            });
            return response;
        } catch (error) {
            throw new Error(error.message);
        }
    }

    static async register(params) {
        const { userAccount, Password, loginType="666", permissionType="666" } = params;
        try {
            const response = await apiClient.post('/register', {
                userAccount,
                Password,
                loginType,
                permissionType
            });
            return response;
        } catch (error) {
            throw new Error(error.message);
        }
    }

    static async logout() {}

    static async fetchUserInfo(userid){
        try {
            const response = await apiClient.post('/get_userinfo',{
                userid: userid,
            });
            return response;
        } catch (error) {
            throw new Error(error.message);
        }
    }
}
